<template>
  <div class="schedulinglog-container">
    <div class="page-title">
      <svg class="icon icon-zhibanguanli" aria-hidden="true">
        <use xlink:href="#icon-zhibanguanli"/>
      </svg>
      <span>值班日志</span>
      <pagego :path="schedulinglogPath"/>
    </div>
    <div class="main-content">
      <div class="tool-bar">
        <!-- <el-pagination
          :current-page="currentPage4"
          :page-sizes="[100, 200, 300, 400]"
          :page-size="100"
          :total="400"
          layout=" prev, pager, next, sizes, total "
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"/> -->
        <span style="font-size: 14px;">所属停车场</span>
        <el-select v-model="value" placeholder="请选择" size="small">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"/>
        </el-select>

        <span style="font-size: 14px;">值班员姓名</span>
        <el-input size="small" style="width:200px"/>

        <!--        <span style="font-size: 14px;">日期</span>
        <el-date-picker
          v-model="value1"
          type="datetime"
          size="small"
          placeholder="选择日期时间"/>-->
        <!--  <el-radio v-model="radio" label="1">停车场</el-radio>
        <el-radio v-model="radio" label="2">报警类型</el-radio>-->
        <div class="search-box">
          <!--<span style="font-size: 14px;margin-right: 10px;">停车场查询</span>
          <el-input
            v-model="searchText"
            size="small"
            clearable/>-->
          <el-button size="small" type="primary" icon="el-icon-search">查询</el-button>
        </div>
      </div>
      <el-table
        :data="tableData"
        border
        stripe
        style="width: 100%">

        <el-table-column
          prop="id"
          label="序号"
          align="center"
          width="50"/>
        <el-table-column
          prop="parking_name"
          label="所属停车场"/>
        <el-table-column
          prop="operator_name"
          label="值班员姓名"/>
        <el-table-column
          prop="telephone"
          label="联系电话"/>
        <!--      <el-table-column
        prop="position"
        width="120"
        label="岗位"/>-->
        <el-table-column
          prop="date"
          label="日期"/>

        <el-table-column
          prop="address"
          width="300"
          align="center"
          label="执行操作">
          <template slot-scope="scope">
            <el-button size="small" icon="el-icon-edit" @click="handleClick(scope.row)">详情</el-button>
            <el-button size="small" icon="el-icon-edit" @click="handleClick(scope.row)">编辑</el-button>
            <el-button size="small" type="danger" icon="el-icon-delete" @click="handleClickDelete(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="tool-bar">
        <el-pagination
          :current-page="currentPage4"
          :page-sizes="[100, 200, 300, 400]"
          :page-size="100"
          :total="400"
          layout=" prev, pager, next, sizes, total "
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"/>
      </div>
    </div>
    <el-dialog :visible.sync="dialogFormVisible" title="编辑信息" width="30%">
      <el-form :model="form">
        <el-form-item :label-width="formLabelWidth" label="所属停车场">
          <el-input v-model="form.parking_name" size="small"/>
        </el-form-item>
        <el-form-item :label-width="formLabelWidth" label="值班员姓名">
          <el-input v-model="form.operator_name" size="small"/>
        </el-form-item>
        <el-form-item :label-width="formLabelWidth" label="联系电话">
          <el-input v-model="form.telephone" size="small"/>
        </el-form-item>
        <!-- <el-form-item :label-width="formLabelWidth" label="岗位">
          <el-input v-model="form.position" size="small"/>
        </el-form-item>-->
        <el-form-item :label-width="formLabelWidth" label="日期">
          <el-date-picker
            v-model="value1"
            type="datetime"
            size="small"
            placeholder="选择日期时间"/>
        </el-form-item>
        <el-form-item :label-width="formLabelWidth" label="工作内容简报">
          <el-input size="small"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" size="small" @click="submitData">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { Message } from 'element-ui'
import Pagego from '../../../components/pageGoBtn/index'

export default {
  name: 'SchedulingLog',
  components: {
    Pagego
  },
  /*  filters: {
    statusFilter: function (status) {
      switch (status) {
        case 1:
          return '正常'
        case 2:
          return '临近期'
        case 3:
          return '已过期'
        case 4:
          return '损坏'
      }
    }
  },*/
  data () {
    return {
      radio: '1',
      value1: '',
      value: 'all',
      options: [{
        value: 'all',
        label: '全部'
      }, {
        value: '2',
        label: '德加酒店停车场'
      }, {
        value: '3',
        label: '家乐福后湖店停车场'
      }, {
        value: '4',
        label: '百佳购物广场停车场'
      }, {
        value: '5',
        label: '仁和里私家小馆停车场'
      }],
      schedulinglogPath: '/example/schedulinglog',
      dialogFormVisible: false,
      form: {
        parking_name: '',
        operator_name: '',
        telephone: '',
        position: '',
        date: '',
        manufacturer: '',
        status: 1
      },
      formLabelWidth: '120px',
      currentPage4: 4,
      searchText: '',
      tableData: [{
        id: '1',
        parking_name: '德加酒店停车场',
        operator_name: '阮建安',
        telephone: '13838090521',
        position: '停车场管理员',
        date: '2019-05-14'
        /*        manufacturer: '众科伟业科技有限公司',
        status: 1*/
      },
      {
        id: '2',
        parking_name: '家乐福后湖店停车场',
        operator_name: '林子帆',
        telephone: '13803821821',
        position: '停车场管理员',
        date: '2019-05-14'
      },
      {
        id: '3',
        parking_name: '百佳购物广场停车场',
        operator_name: '夏志豪',
        telephone: '13803812520',
        position: '停车场管理员',
        date: '2019-05-14'
      },
      {
        id: '4',
        parking_name: '百佳购物广场停车场',
        operator_name: '张诗刚',
        telephone: '13607653001',
        position: '停车场管理员',
        date: '2019-05-14'
      },
      {
        id: '5',
        parking_name: '家乐福后湖店停车场',
        operator_name: '黎慧萱',
        telephone: '18738158168',
        position: '停车场管理员',
        date: '2019-05-14'
      },
      {
        id: '6',
        parking_name: '仁和里私家小馆停车场',
        operator_name: '林培伦',
        telephone: '13803822260',
        position: '停车场管理员',
        date: '2019-05-14'
      },
      {
        id: '7',
        parking_name: '家乐福后湖店停车场',
        operator_name: '苏姿婷',
        telephone: '15937188817',
        position: '停车场管理员',
        date: '2019-05-14'
      },
      {
        id: '8',
        parking_name: '家乐福后湖店停车场',
        operator_name: '王淑月',
        telephone: '13700851521',
        position: '停车场管理员',
        date: '2019-05-14'
      }]
    }
  },
  watch: {},
  methods: {
    handleClick (row) {
      console.log(row)
      this.dialogFormVisible = true
      this.form = row
    },
    handleClickDelete (row) {
      console.log(row.id)
      Message.success('删除成功～')
    },
    submitData () {
      this.dialogFormVisible = false
      Message.success('编辑成功～')
    },
    handleSizeChange (val) {
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange (val) {
      console.log(`当前页: ${val}`)
    }
  }
}
</script>

<style lang="stylus" scoped>
.schedulinglog-container{
  margin: 15px;
  color: #828282;
  font-size: 16px;
  background-color: #fff;
  padding-top: 0px;
  .status-span{
    color: #fff;
    display: inline-block;
    padding: 0px 10px;
    font-size: 12px;
  }
  .color-span-1{
    background-color: #5cb85c;
  }
  .color-span-2{
    background-color: #5bc0de;
  }
  .color-span-3{
    background-color: #f0ad4e;
  }
  .color-span-4{
    background-color: #d9534f;
  }
  .el-input{
    display: inline-block;
  }
  .page-title{
    width:100%;
    height: 44px;
    line-height: 44px;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 5px;
    padding: 0 15px;
    .icon{
      width: 22px;
      height: 22px;
      position: relative;
      top: 3px;
    }
  }
  .main-content{
    padding: 15px;
    padding-top: 0px;
    .tool-bar {
      padding: 10px 0px;
      position: relative;
      .search-box{
        position: absolute;
        right: 10px;
        top: 10px;
        .el-input{
          width: 120px;
        }
      }
    }
  }
}
</style>
